Skip Headers

Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
Home | Book List | Contents | Index | Master Index | Feedback

# CanUpdate Method

Applies To

ODynaset

Description

This method returns TRUE if the ODynaset is updatable.

Usage

oboolean CanUpdate(void) const

Remarks

Depending on the SQL statement that is used to Open or Refresh the ODynaset, it may or may not be possible to make changes to the dynaset. Several factors can make a dynaset non-updatable:

- The SQL statement may contain fields that are not database table columns (for example, computed fields or fields whose names have been aliased).
- The SQL statement may reference columns in more than one database field (a join).
- The user may not have privileges to update the table the dynaset is on.
- The dynaset may have been opened with the ODYNASET_READONLY option.

Note that even if the SQL statement references only a single view, the dynaset will not be updatable if that view is created by way of a join, computed columns, or aliased columns.

Return Value

TRUE if the dynaset is updatable; FALSE if not.

Example

Here are examples of dynaset updatability.

// we assume the existence of an open ODatabase named odb

ODynaset dyn; // construct an ODynaset

// now open the ODynaset with various SQL statements

dyn.Open(odb, "select * from emp");

if (dyn.CanUpdate()) ; // is TRUE

dyn.Open(odb, "select sal*1.1 from emp");

if (dyn.CanUpdate()) ; // FALSE because of computed field

dyn.Open(odb, "select emp.ename, dept.dname from emp, dept \

where emp.deptno = dept.deptno");

if (dyn.CanUpdate()) ; // FALSE because of join